<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class SysConfig extends MY_Controller {
	
	public function index(){
		$data = array();
		
		$this->load->model('Main/ConfigModel', 'cfg');
		$list = $this->cfg->get_lists();
		$data['list'] = $list;
		$this->load->view('sysconfig',$data);
	}
	
	function save(){
		
		$f = $this->input->post('f',null,array());
		
		$arr = array();
		foreach($f as $key=>$val){
			$arr[$key] = $val;
		}
		
		$this->load->model('Main/ConfigModel', 'cfg');
		
		foreach($arr as $key=>$val){
			
			$this->cfg->edit(array('info'=>$val),"name='{$key}'");
		}
		
		
		$this->message("提交成功",site_url('SysConfig/index'));
	}
}

?>